import os, sys
from _util import run_cmd

os.putenv('PYTHON', sys.executable)
basedir = os.path.abspath(os.path.dirname(__file__))
if len(sys.argv) == 1: 
	name = 'Twisted'
else: 
	name = sys.argv[1]
script = os.path.join(basedir, name + '.sh')
if not os.path.exists(script):
    print 'Unknown project: %s' % (name,)
    sys.exit(1)
cmd = script
print "Running", cmd
rc, output = run_cmd(cmd)
print output
print "Exit code:", rc
sys.exit(rc)

#os.system("/home/twistbot/pybot/python-tool/prepare_packages.sh")
#PYTHON_BINARY = sys.executable
#cmd = PYTHON_BINARY + " -Wall /tmp/Twisted/bin/trial --reporter=bwverbose --random=0 twisted"
#print "Running", cmd
#rc, output = run_cmd(cmd)
#print output
#print "Exit code:", rc
#sys.exit(rc)

